package com.asktgapp.receiver;

import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;

import com.asktgapp.application.MyApplication;
import com.asktgapp.modulebase.common.util.PreferencesUtil;
import com.asktgapp.modulebase.common.util.Util;
import com.sobot.chat.SobotApi;
import com.sobot.chat.api.model.Information;

public class MyZhiChiReceiver extends BroadcastReceiver {
    @Override
    public void onReceive(Context context, Intent intent) {
        Information info = new Information();
        info.setAppkey("9d6b46705cd648b9bf1b66be4a9438bf");  //分配给App的的密钥
        //注意：uid为用户唯一标识，不能传入一样的值
        if (!Util.isEmpty(PreferencesUtil.getString(MyApplication.getInstance(), PreferencesUtil.USER_ID))) {
            info.setUid(PreferencesUtil.getString(MyApplication.getInstance(), PreferencesUtil.USER_ID));
//用户昵称，选填
//            info.setUname(PreferencesUtil.getString(MyApplication.getInstance(), PreferencesUtil.KEY_NAME));
//用户电话，选填
            info.setTel(PreferencesUtil.getString(MyApplication.getInstance(), PreferencesUtil.KEY_PHONE));
        }
        SobotApi.startSobotChat(MyApplication.getInstance(), info);
    }
}
